// Variables.cpp

// Implementacia Variables.h

#include "Player/World/Variables.h"
#include "Player/World/World.h"
#include <string.h>

// Konstruktor
Variables::Variables(World* w) : WorldObject(w)
{

}
// Kopirovaci konstruktor
Variables::Variables(const Variables& variables) : WorldObject(variables.world)
{

}

// Destruktor
Variables::~Variables()
{

}

Variables& Variables::operator =(const Variables& variables)
{
	if(&variables == this)
		return *this;
	WorldObject::operator=(variables);
	return *this;
}

void Variables::Initialize()
{
	// Nastavi standardne hodnoty parametrov rozhodovacieho stromu
	// Na nastavenie niektorych parametrov rozhodovacieho stromu potrebujeme parametre servera
	distanceToGoal = 17.f;
	kickToGoalDirection = 0;
	
	dribleSurroundingsMaxWidth = 5;
	dribleSurroundingsMinWidth = world->params->server->player_size + world->params->server->ball_size + world->params->server->kickable_margin; 
		
	passSurroundingsMinWidth = 3;
	passSurroundingsMaxWidth = 30;
	minXPosition = -20;
	maxXPosition = 20;

	friendDashAdjust = 6.f / 5.f;
	enemyDashAdjust	 = 1.f;

	friendBallCtrlBonus = 1.1f;
	enemyBallCtrlBonus	= 1.1f;

#ifdef GOALIE
	tooMuchFriendCnt	= 0.1f;
	tooMuchEnemyCnt		= 0.1f;
#else // GOALIE
	tooMuchFriendCnt	= 0.25f;
	tooMuchEnemyCnt		= 2.1f;
#endif // GOALIE

	useNeuralNetwork = false;
}

bool Variables::ParseVariable(const char *name, const char *value)
{
	if(strcmp(name, "UseNeuralNetwork") == 0)
	{
		if(strcmp(value, "on") == 0) 
			useNeuralNetwork = true;
		else if(strcmp(value, "off") == 0)
			useNeuralNetwork = false;
		else
			return false;

		return true;
	}
	// Pridanie ostatnych parametrov

	return false;
}

